<template>
	<view class="context" v-show="show" :style="{'width':windowWidth +'px','height': windowHeight +'px'}">
		<view class="vue-cropper" ref="cropper" :style="{'left':(windowWidth - w) /2 +'px','top': (windowHeight - h) / 2 +'px'}" >
			<view class="cropper-box">
				<view class="cropper-box-canvas" 
					@mousedown.stop.prevent="imgMouseDown"
					@mousemove.stop.prevent= "imgMousemove"
					@mouseup.stop.prevent="imgMouseup"
					:style="{
						'width': imageRealWidth + 'px',
						'height': imageRealHeight + 'px',
						'top':(h - imageRealHeight) / 2 +'px',
						'left':(w - imageRealWidth) / 2 + 'px',
						'transform': 'scale(' + scale + ',' + scale + ') ' 
						+ 'translate3d('+ x / scale + 'px,' + y / scale + 'px,' + '0)'
						+ 'rotateZ('+ rotate * 90 +'deg)'
						}">
					<image :src="src" alt="cropper-img" ref="cropperImg" mode="scaleToFill" class="uni-image"></image>
				</view>
			</view>
			<view class="cropper-drag-box cropper-modal cropper-move pointer-events"></view>
			<view class="cropper-crop-box" :class="{'pointer-events': cropFixed}" 
					:style="{'width': cropW + 'px',
							 'height': cropW + 'px',
							 'transform': 'translate3d('+ cropOffsertX + 'px,' + cropOffsertY + 'px,' + '0)'}">
				<view class="cropper-view-box">
					<image :style="{'width': imageRealWidth + 'px',
									'height': imageRealHeight + 'px',
									'top':(h - imageRealHeight) / 2 +'px',
									'left':(w - imageRealWidth) / 2 + 'px',
									'transform': 'scale(' + scale + ',' + scale + ') '
									 + 'translate3d('+ (x - cropOffsertX) / scale  + 'px,' 
									 + (y - cropOffsertY) / scale + 'px,' + '0)' 
									 + 'rotateZ('+ rotate * 90 +'deg)'}"
							mode="scaleToFill" :src="src" alt="cropper-img"></image>
				</view>

				<view v-if="!cropFixed" class="cropper-face cropper-move" 
					@mousedown.stop.prevent="mouseDownTouchStart"
					@mousemove.stop.prevent= "mouseMoveCropMoveing"
					@mouseup.stop.prevent="mouseupCropMoveing"></view>

				<view class="crop-line line-w"></view>
				<view class="crop-line line-a"></view>
				<view class="crop-line line-s"></view>
				<view class="crop-line line-d"></view>
				<block v-if="!cropFixed">
					<view class="crop-point point-lt" 
						@mousedown.stop.prevent="changeRectMousedown"
						@mousemove.stop.prevent="changeRectMousemove($event, 'left-top')"
						@mouseup.stop.prevent="changeRectMouseup"></view>
					<view class="crop-point point-mt" 
						@mousedown.stop.prevent="changeRectMousedown"
						@mousemove.stop.prevent="changeRectMousemove($event, 'middle-top')"
						@mouseup.stop.prevent="changeRectMouseup"></view>
					<view class="crop-point point-rt" 
						@mousedown.stop.prevent="changeRectMousedown"
						@mousemove.stop.prevent="changeRectMousemove($event, 'right-top')"
						@mouseup.stop.prevent="changeRectMouseup"></view>
					<view class="crop-point point-ml"
						@mousedown.stop.prevent="changeRectMousedown"
						@mousemove.stop.prevent="changeRectMousemove($event, 'middle-left')"
						@mouseup.stop.prevent="changeRectMouseup"></view>
					<view class="crop-point point-mr" 
						@mousedown.stop.prevent="changeRectMousedown"
						@mousemove.stop.prevent="changeRectMousemove($event, 'middle-right')"
						@mouseup.stop.prevent="changeRectMouseup"></view>
					<view class="crop-point point-lb" 
						@mousedown.stop.prevent="changeRectMousedown"
						@mousemove.stop.prevent="changeRectMousemove($event, 'left-bottom')"
						@mouseup.stop.prevent="changeRectMouseup"></view>
					<view class="crop-point point-mb" 
						@mousedown.stop.prevent="changeRectMousedown"
						@mousemove.stop.prevent="changeRectMousemove($event, 'middle-bottom')"
						@mouseup.stop.prevent="changeRectMouseup"></view>
					<view class="crop-point point-rb" 
						@mousedown.stop.prevent="changeRectMousedown"
						@mousemove.stop.prevent="changeRectMousemove($event, 'right-bottom')"
						@mouseup.stop.prevent="changeRectMouseup"></view>
						
				</block>
			</view>

			<canvas id="myCanvas" canvas-id="myCanvas" class="cropper-canvas" :style="{ 'width': cropW + 'px','height': cropW + 'px' }"></canvas>
			<view class="uni-info__ft">
				<!--取消  -->
				<view class="uni-modal__btn uni-modal__btn_default" style="color: rgb(0, 0, 0);" @tap="cancel">{{cancelTxt}}</view>
				
				<view class="uni-modal__btn uni-modal__btn_default" style="color: rgb(0, 0, 0);" @tap="originalConfirm">{{original}}</view>
				<!-- 缩小 -->
				<view class="uni-modal__btn uni-modal__btn_default" v-show="showResetBtn" @tap="scaleHandler(0)">{{narrowTxt}}</view>
				<!-- 放大 -->
				<view class="uni-modal__btn uni-modal__btn_default" v-show="showResetBtn" @tap="scaleHandler(1)">{{enlargeTxt}}</view>
				<!-- 重置 -->
				<view class="uni-modal__btn uni-modal__btn_default" v-show="showResetBtn" @tap="init">{{resetTxt}}</view>
				<!-- 旋转 -->
				<view class="uni-modal__btn uni-modal__btn_default" v-show="showRotateBtn" @tap="rotateHandler">{{rotateTxt}}</view>
				<!-- 确定 -->
				<view class="uni-modal__btn uni-modal__btn_primary" style="color: rgb(0, 122, 255);" @tap="confirm">{{determineTxt}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import lang from "../../js/conf/Lang.js";
	import eventCtrl from "../../js/event/EventCtrl.js";
	export default {
		// name: 'image-cropper',
		props: {
			cropWidth: {
				type: Number,
				default: 200,
			},
			cropHeight: {
				type: Number,
				default: 200
			},
			cropFixed: {
				type: Boolean,
				default: false,
			},
			src: {
				type: String,
			},
			showResetBtn: {
				type: Boolean,
				default: true,
			},
			showRotateBtn: {
				type: Boolean,
				default: true,
			},
			curEditType : 
			{
				type: Number,
				default: -1,
			}
		},
		data() {
			var sysInfo = uni.getSystemInfoSync();
			const pixelRatio = sysInfo.pixelRatio;
			return {
				cancelTxt : lang.imageCropperTxt.cancel,//"取消"
				original : lang.imageCropperTxt.original,//上传原图
				narrowTxt : lang.imageCropperTxt.narrow,//"缩小",
				enlargeTxt : lang.imageCropperTxt.enlarge,//"放大",
				resetTxt : lang.imageCropperTxt.reset,//"重置",
				rotateTxt :  lang.imageCropperTxt.rotate,//."旋转",
				determineTxt : lang.imageCropperTxt.determine,//"确定",
				
				show: false,
				scale: 1,
				rotate: 0,
				cropW: 0,
				cropH: 0,
				cropOldW: 0,
				cropOldH: 0,
				sysInfo: sysInfo,
				pixelRatio: pixelRatio,
				imageRealWidth: 0,
				imageRealHeight: 0,
				cropOffsertX: 0,
				cropOffsertY: 0,
				startX: 0,
				startY: 0,
				// 裁剪框与边界间距
				// border: 5,
				border: 0,
				x: 0,
				y: 0,
				w:700,
				h:748,
				startL: 0,
				oldScale: 1,
				cMove:false,
				rcMove:false,
			}
		},
		watch: {
			src(val) {
				if (val.length > 0) {
					this.init();
				}
			},
			show(val) {
				if (!val) {
					//this.src = '';
				}
			}
		},
		computed: {
			containerTop() {
				let top = 0;
				top = 0;
				return top;
			},
			// 容器高度
			containerHeight() {
				return this.windowHeight - 48;
			},
			// 屏幕宽度
			windowWidth() {
				return this.sysInfo.windowWidth ;
			},
			windowHeight() {
				return this.sysInfo.windowHeight;
			},
			// 图片宽高比
			imageRatio() {
				if (this.imageRealHeight > 0) {
					return this.imageRealWidth / this.imageRealHeight;
				}
				return 0
			},
			// 等比缩放后的宽度
			imageWidth() {
				if (this.imageRatio >= 1) {
					return this.windowWidth;
				}
				return this.windowWidth * this.imageRatio;
			},
			// 等比缩放后的高度
			imageHeight() {
				if (this.imageRatio >= 1) {
					return this.windowWidth / this.imageRatio;
				}
				return this.windowWidth;
			},
		},
		
		methods: {
			rotateHandler() {
				this.rotate ++;
				this.rotate = this.rotate % 3;
			},
			init() {
				this.rotate = 0;
				this.scale = 1;
				this.cropW = this.cropWidth;
				this.cropH = this.cropHeight;
				this.startX = 0;
				this.startY = 0;
		        this.x = 0;
				this.y = 0;
				// uni.showLoading({
				// 	title: '图片加载中...',
				// })
				this.loadImage(this.src).then((e) => {
					uni.hideLoading()
				}).catch((e) => {
					// uni.hideLoading()
					// uni.showModal({
					// 	title: '标题',
					// 	content: '图片加载失败'
					// })
				})
			},
			
			
			scaleHandler(type)
			{
				if(type == 0)//缩小
				{
					this.scale = this.scale - .1;
				}
				else
				{
					this.scale = this.scale + .1;
				}
			},
			
			loadImage(src) {
				const _this = this;
				return new Promise((resolve, reject) => {
					uni.getImageInfo({
						src: src,
						success: (res) => {
							_this.imageRealWidth = res.width;
							_this.imageRealHeight = res.height;

							_this.cropOffsertX = _this.w / 2 - _this.cropW / 2;
							_this.cropOffsertY = _this.h / 2 - _this.cropW / 2;
							_this.show = true;
							_this.$nextTick(() => {
								// _this.x = _this.windowWidth / 2 - _this.imageWidth / 2;
								// _this.y = _this.containerHeight / 2 - _this.imageHeight / 2;
							});
							resolve(res);
						},
						fail: (e) => {
							_this.show = false;
							reject(e)
						}
					})
				});

			},
			cancel() {
				
				this.scaling = false;
				this.scale = 1;
				this.cMove = false;
				this.rcMove = false;
				this.show = false;
				this.$emit('cancel');
			},
			
			originalConfirm(event)
			{
				// event.detail.tempFilePath = 
				// event.original = true;
				this.show = false;
				console.log("原图===：",this.src);
				
				let obj = {};
				obj.tempFilePath = this.src;
				obj.original = true;
				
				this.$emit('confirm', obj);
			},
			
			confirm(event) {
				console.log('裁剪中裁剪中裁剪中裁剪中')
				uni.showLoading({
					title: '裁剪中...',
				})
				const _this = this;
				const ctx = uni.createCanvasContext('myCanvas', _this);
				console.log(ctx,'createCanvasContextcreateCanvasContext')

				const pixelRatio = _this.pixelRatio;
				const imgage = _this.src;
				const imgW = _this.imageRealWidth * _this.scale;
				const imgH = _this.imageRealHeight * _this.scale;
				
				const rotate = _this.rotate;
				
				let dx = _this.cropOffsertX - _this.x - (_this.w - imgW) / 2;
				let dy = _this.cropOffsertY - _this.y - (_this.h - imgH) / 2;
			               
				ctx.setFillStyle('white');
				ctx.fillRect(0, 0, imgW, imgH);
				ctx.save();
				
				ctx.rotate((rotate * 90 * Math.PI) / 180);
		

				switch (rotate) {
					case 1:
						dx += (imgH - imgW) / 2;
						dy -= (imgH - imgW) / 2;
						ctx.drawImage(imgage, -dy, dx, imgW, -imgH);
						break;
					case 2:
						ctx.drawImage(imgage, dx, dy, -imgW, -imgH);
						break;
					case 3:
						dx += (imgH - imgW) / 2
						dy -= (imgH - imgW) / 2
						ctx.drawImage(imgage, dy, -dx, -imgW, imgH);
						break;
					default:
						ctx.drawImage(imgage, -dx, -dy, imgW, imgH);
						break;
				}
				ctx.restore();
				ctx.draw(false, () => {
					uni.canvasToTempFilePath({
						canvasId: 'myCanvas',
						destWidth: _this.cropW * pixelRatio,
						destHeight: _this.cropW * pixelRatio,
						success: (res) => {
							console.log(res,'221212122')
							uni.hideLoading();
							// console.log("aaaaa");
							// event.detail.tempFilePath = res.tempFilePath;
							// event.original = false;
							let obj = {};
							obj.tempFilePath = res.tempFilePath;
							obj.original = false;
							_this.show = false;
							// alert(event.detail.tempFilePath);
							_this.$emit('confirm', obj);
						},
						fail: (e) => {
							console.log(res,'333')
							uni.hideLoading()
							uni.showModal({
								title: '提示',
								content: '裁剪失败'
							})
						}
					}, _this);
				});

			},
			
			imgTouchStart(e) {
				if (e.touches.length == 2) {
					this.oldScale = this.scale;
					this.scaling = true
					const x = e.touches[0].pageX - e.touches[1].pageX;
					const y = e.touches[0].pageY - e.touches[1].pageY;
					const hypotenuse = Math.sqrt(
						Math.pow(x, 2) +
						Math.pow(y, 2)
					)

					this.startL = Math.max(x, y, hypotenuse)
					uni.showModal({
						content: this.startL
					})
				} else {
					this.startX = e.touches[0].pageX - this.x;
					this.startY = e.touches[0].pageY - this.y;
				}
			},
			
			imgMouseDown(e)
			{
				this.scaling = true;
				this.startX = e.pageX - this.x;
				this.startY = e.pageY - this.y;
			},
							
			imgMousemove(e)
			{
				if (this.scaling) 
				{
					const moveX = e.pageX - this.startX;
					const moveY = e.pageY - this.startY;
					this.x = moveX;
					this.y = moveY;
				}
			},
			
			imgMouseup()
			{
				this.scaling = false;
				this.cMove = false;
				this.rcMove = false;
			},
			
			imgMoveEnd() {
				setTimeout(() => {
					this.scaling = false
				}, 100);
			},
			
			touchStart(e) {
				this.startX = e.touches[0].pageX - this.cropOffsertX;
				this.startY = e.touches[0].pageY - this.cropOffsertY;

				this.cropOldW = this.cropW;
				this.cropOldH = this.cropW;
			},
			
			mouseDownTouchStart(e) {
				this.cMove = true;
				this.rectMouseDown(e);
			},
			
			rectMouseDown(e)
			{
				this.startX = e.pageX - this.cropOffsertX;
				this.startY = e.pageY - this.cropOffsertY;
							
				this.cropOldW = this.cropW;
				this.cropOldH = this.cropW;
			},
			
			changeRectMousedown(e)
			{
				this.rcMove = true;
				this.rectMouseDown(e);
			},
			
			cropMoveing(e) {
				const moveX = this._cropX(e.touches[0].pageX - this.startX);
				const moveY = this._cropY(e.touches[0].pageY - this.startY);
				this.cropOffsertX = moveX;
				this.cropOffsertY = moveY;
			},
			
			mouseMoveCropMoveing(e) 
			{
				if(this.cMove)
				{
					const moveX = this._cropX(e.pageX - this.startX);
					const moveY = this._cropY(e.pageY - this.startY);
								
					this.cropOffsertX = moveX;
					this.cropOffsertY = moveY;
				}
				
			},
			
			mouseupCropMoveing() 
			{
				this.cMove = false;
				this.rcMove = false;
			},
			
			changeRectMousemove(e, type) 
			{
				console.log("type======:",type);
				console.log("this.rcMove======:",this.rcMove);
				if(!this.rcMove)return;
				const moveX = e.pageX - this.startX;
				const moveY = e.pageY - this.startY;
				this.change(type,moveX,moveY);
			},
			
			changeRectMouseup()
			{
				this.rcMove = false;
				this.cMove = false;
			},
			
			change(type,moveX,moveY)
			{
				switch (type) {
					case 'left-top':
						this._cropMoveLeft(moveX);
						this._cropMoveTop(moveY);
						break;
					case 'middle-top':
					
						this._cropMoveRight(moveX);
						this._cropMoveTop(moveY);
						break;
					case 'right-top':
						this._cropMoveTop(moveY);
						this._cropMoveRight(moveX);
						break;
					case 'middle-right':
						this._cropMoveRight(moveX);
						break;
					case 'right-bottom':
						this._cropMoveRight(moveX);
						this._cropMoveBottom(moveY);
						break;
					case 'middle-bottom':
						this._cropMoveRight(moveX);
						this._cropMoveBottom(moveY);
						break;
					case 'left-bottom':
						this._cropMoveBottom(moveY);
						this._cropMoveLeft(moveX);
						break;
					case 'middle-left':
						this._cropMoveLeft(moveX);
						break;
					default:
						break;
				}
			},
			
			_cropMoveTop(y) {
				const topY = this._cropY(y);
				this.cropH += this.cropOffsertY - topY;
				this.cropOffsertY = topY;
			},
			
			_cropMoveRight(x) {
				if (this.cropOldW + x >= this.windowWidth - this.border) {
					return false;
				}
				this.cropW = this.cropOldW + (x - this.cropOffsertX);
			},
			
			_cropMoveBottom(y) {
				if (this.cropOldH + y >= this.windowHeight - this.containerTop - this.border) {
					return false;
				}
				// console.log(this.cropOldH,y,this.cropOffsertY);
				this.cropH = this.cropOldH + (y - this.cropOffsertY);
			},
			
			_cropMoveLeft(x) {
				const leftX = this._cropY(x)
				this.cropW += this.cropOffsertX - leftX;
				this.cropOffsertX = leftX;
			},
			
			
			_cropX(x) {
				if (x <= this.border) {
					return this.border;
				}
				
				if (x + this.cropW >= this.w - this.border) {
					return this.w - this.cropW - this.border;
				}
				
				return x
			},
			_cropY(y) {
				if (y <= this.border) {
					return this.border;
				}
				if (y + this.cropH >= this.w - this.containerTop - this.border) {
					return this.w - this.cropH - this.containerTop - this.border;
				}
				return y;
			},
			
			/***窗口尺寸变化*****/
			onResizeHandler(res)
			{
				if(this.show)
				{
					this.sysInfo = uni.getSystemInfoSync();
				}
			},
		},
		
		mounted() {
			uni.$on(eventCtrl.CHANGE_SIZE_EVENT,this.onResizeHandler);
		},
	}
</script>

<style scoped lang="css">
    .context
	 {
		position: fixed;
		background-color: rgba(0,0,0,.4);
		z-index: 9988;
		top:0;
		left:0;
	 }
	.vue-cropper {
		position: relative;
		width: 700px;
		height: 748px;
		/* left: 0;
		right: 0;
		bottom: 0; */
		
		box-sizing: border-box;
		user-select: none;
		-webkit-user-select: none;
		-moz-user-select: none;
		-ms-user-select: none;
		direction: ltr;
		touch-action: none;
		text-align: left;
		overflow: hidden;
		background-image: url("");
	}

	.cropper-canvas {
		position: absolute;
		top: -9999px;
		left: -9999px;
		z-index: -9988;
	}

	.vue-cropper .uni-info__ft {
		position: absolute;
		line-height: 48px;
		font-size: 18px;
		display: -webkit-box;
		display: -webkit-flex;
		display: flex;
		bottom: 0;
		left: 0;
		right: 0;
		z-index: 9988;
		cursor: pointer;
	}

	.btn-group {
		position: absolute;
		right: 30px;
		bottom: 78px;
		z-index: 9988;
	}

	.btn-item {
		position: relative;
		width: 40px;
		height: 40px;
		background: #fff;
		border-radius: 20px;
		padding: 10px;
		display: inline-block;
		margin-left: 10px;
	}

	.btn-item:active {
		background: #ccc;
	}

	.rotate-btn {
		/* font-family: "icon-font" !important; */
		font-size: 24px;
		font-style: normal;
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
		line-height: 20px;
	}

	.rotate-btn:before {
		content: "\e66f";
		margin-left: -2px;
	}

	.reset-btn {
		/* font-family: "icon-font" !important; */
		font-size: 24px;
		font-style: normal;
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
		line-height: 20px;
	}

	.reset-btn:before {
		content: "\e610";
		margin-left: -2px;
	}

	.vue-cropper .uni-info__ft:after {
		content: " ";
		position: absolute;
		left: 0;
		top: 0;
		right: 0;
		height: 1px;
		border-top: 1px solid #d5d5d6;
		color: #d5d5d6;
		-webkit-transform-origin: 0 0;
		transform-origin: 0 0;
		-webkit-transform: scaleY(.5);
		transform: scaleY(.5);
		z-index: 9988;
	}

	.vue-cropper .uni-modal__btn {
		display: block;
		-webkit-box-flex: 1;
		-webkit-flex: 1;
		flex: 1;
		color: #3cc51f;
		text-decoration: none;
		-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
		position: relative;
		text-align: center;
		background-color: #fff;
		z-index: 9988;
	}

	.vue-cropper .uni-modal__btn:first-child:after {
		display: none
	}

	.vue-cropper .uni-modal__btn:after {
		content: " ";
		position: absolute;
		left: 0;
		top: 0;
		width: 1px;
		bottom: 0;
		border-left: 1px solid #d5d5d6;
		color: #d5d5d6;
		-webkit-transform-origin: 0 0;
		transform-origin: 0 0;
		-webkit-transform: scaleX(.5);
		transform: scaleX(.5);
		z-index: 9988;
	}

	.vue-cropper .uni-modal__btn:active {
		background-color: #eee;
	}

	.cropper-box,
	.cropper-box-canvas,
	.cropper-drag-box,
	.cropper-crop-box,
	.cropper-face {
		position: absolute;
		/* top: 0;
		right: 0;
		bottom: 0;
		left: 0; */
		width: 100%;
		height: 100%;
		user-select: none;
		z-index: 9988;
	}

	.uni-image {
		width: 100%;
		height: 100%;
	}

	.cropper-box-canvas image {
		position: relative;
		text-align: left;
		user-select: none;
		transform: none;
		max-width: none;
		max-height: none;
		z-index: 9988;
	}

	.cropper-box {
		overflow: hidden;
	}

	.cropper-move {
		cursor: move;
	}

	.cropper-crop {
		cursor: crosshair;
	}

	.cropper-modal {
		background: rgba(0, 0, 0, 0.5);
	}

	.pointer-events {
		pointer-events: none;
	}

	.cropper-crop-box {
		/*border: 2px solid #39f;*/
	}

	.cropper-view-box {
		display: block;
		overflow: hidden;
		width: 100%;
		height: 100%;
		outline: 1px solid #39f;
		outline-color: rgba(51, 153, 255, 0.75);
		user-select: none;
	}

	.cropper-view-box image {
		user-select: none;
		text-align: left;
		max-width: none;
		max-height: none;
	}

	.cropper-face {
		top: 0;
		left: 0;
		background-color: #fff;
		opacity: 0.1;
	}

	.crop-line {
		position: absolute;
		display: block;
		width: 100%;
		height: 100%;
		opacity: 0.1;
		z-index: 9988;
	}

	.line-w {
		top: -3px;
		left: 0;
		height: 5px;
		cursor: n-resize;
	}

	.line-a {
		top: 0;
		left: -3px;
		width: 5px;
		cursor: w-resize;
	}

	.line-s {
		bottom: -3px;
		left: 0;
		height: 5px;
		cursor: s-resize;
	}

	.line-d {
		top: 0;
		right: -3px;
		width: 5px;
		cursor: e-resize;
	}

	.crop-point {
		position: absolute;
		width: 20px;
		height: 20px;
		opacity: .7;
		background-color: #39f;
		border-radius: 100%;
		z-index: 9988;
	}

	.point-lt {
		top: -10px;
		left: -10px;
		cursor: nw-resize;
	}

	.point-mt {
		top: -10px;
		left: 50%;
		margin-left: -10px;
		cursor: n-resize;
	}

	.point-rt {
		top: -10px;
		right: -10px;
		cursor: ne-resize;
	}

	.point-ml {
		top: 50%;
		left: -10px;
		margin-top: -10px;
		cursor: w-resize;
	}

	.point-mr {
		top: 50%;
		right: -10px;
		margin-top: -10px;
		cursor: e-resize;
	}

	.point-lb {
		bottom: -10px;
		left: -10px;
		cursor: sw-resize;
	}

	.point-mb {
		bottom: -10px;
		left: 50%;
		margin-left: -5px;
		cursor: s-resize;
	}

	.point-rb {
		bottom: -10px;
		right: -10px;
		cursor: se-resize;
	}
</style>